package org.mendoza.salud.hvt.client.local.gui;

import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.PasswordTextBox;
import com.google.gwt.user.client.ui.TextBox;
import org.jboss.errai.ui.nav.client.local.TransitionTo;
import org.jboss.errai.ui.shared.api.annotations.DataField;
import org.jboss.errai.ui.shared.api.annotations.EventHandler;
import org.jboss.errai.ui.shared.api.annotations.Templated;
import org.mendoza.salud.hvt.client.local.gui.navigation.PaisPage;
import org.mendoza.salud.hvt.client.local.gui.navigation.TipoDeDocumentoPage;
import org.mendoza.salud.hvt.client.local.gui.persona.TipoDeDocumentoView;

import javax.inject.Inject;

@Templated("#root")
public class LoginView extends Composite{

    @Inject
    @DataField("password")
    PasswordTextBox password;

    @Inject
    @DataField("username")
    TextBox username;

    @Inject
    @DataField("submit")
    Button submit;

    @Inject
    @DataField("cancel")
    Button cancel;

    @Inject
    TransitionTo<PaisPage> clickToPaisPage;

    @Inject
    TransitionTo<TipoDeDocumentoPage> clickToTipoDeDocumento;

    @EventHandler("submit")
    public void clickSubmit(ClickEvent clickEvent) {
        clickToPaisPage.go();
    }

    @EventHandler("cancel")
    public void clickCancel(ClickEvent clickEvent) {
        clickToTipoDeDocumento.go();
    }

}
